package com.itruth;

import java.sql.Timestamp;

import net.sf.json.JSONArray;
import net.sf.json.JSONException;
import net.sf.json.JSONObject;

import com.itruth.entity.ShareEntity;

public class Main {
	
	public static void main(String[] args) {
		
		ShareEntity user = new ShareEntity("lanyan", "123456", new Timestamp(System.currentTimeMillis()));
//		
		JSONObject json = new JSONObject();
		json.put("name", "lanyan");
		json.accumulate("age", 24);
//		json.accumulate("user", user);
		System.out.println(json.toString());
//		
//		JSONArray array = new JSONArray();
////		array.add(json);
//		array.add(user);
//		System.out.println(array.toString());
//		
//		StringBuffer sb = new StringBuffer();
//		System.out.println(sb.toString().length());
		
		System.out.println(getJsonObject("abc"));
		
	}
	
	public static JSONObject getJsonObject(String data) {
		JSONObject json = null;
		
			try {
				json = JSONObject.fromObject(data);
			} catch (JSONException e) {
				e.printStackTrace();
			}
		
		return json;
		
	}
	
}
